/*
  User: MissingAeon
  Date: 2024/5/23
  Time: 8:58
--*/
import type { CommonResult } from "@/api";
import type { CancelablePromise } from "@/api";
import { OpenAPI } from "@/api";
import { request as __request } from "../core/request";
import { ChatMessageMatchDto } from "@/api";
import { useUserStore } from "@/store";

/**
 * PrivateChatMessageServices 私信消息服务API
 */
export class PrivateChatMessageServices {
  /**
   * 获取一个私信的历史消息
   * @returns CommonResult OK
   * @throws ApiError
   * @param chatMessageMatchDto
   */
  public static getHistoricalMessages(
    chatMessageMatchDto: ChatMessageMatchDto,
  ): CancelablePromise<CommonResult> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/private/message",
      query: chatMessageMatchDto,
      mediaType: "application/json",
      headers: {
        Authorization: useUserStore().applyToken,
      },
    });
  }

  /**
   * 删除一条消息
   * @returns CommonResult OK
   * @throws ApiError
   * @param messageId 消息id
   */
  public static hidePrivateLetter(
    messageId: string,
  ): CancelablePromise<CommonResult> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/private/message/{messageId}",
      path: {
        messageId: messageId,
      },
    });
  }
}
